package com.igoal.service;

import java.util.Date;
import java.util.List;

import org.springframework.transaction.annotation.Transactional;

import com.igoal.dto.NewsDTO;
import com.igoal.dto.TagDTO;
import com.igoal.entity.ComponentEnum;
import com.igoal.entity.Taggable;

public interface TagService {
	@Transactional(readOnly=true)
	List<TagDTO> listAll();
	
	@Transactional(readOnly=false)
	int addTag(String tagName);
	
	@Transactional(readOnly=false)
	int tagComponent(String username, Long tagId, String tagName, ComponentEnum component, Long componentId);
	
	@Transactional(readOnly=false)
	int tagComponent(String username, Long[] tagIds, String[] tagNames, ComponentEnum component, Long componentId);
	
	@Transactional(readOnly=false)
	int removeTagComponent(String username, Long tagId, ComponentEnum component, Long componentId);
	
	@Transactional(readOnly=true)
	List<NewsDTO> listTaggedNews(Long tagId, String tagName, Date lastComponentCreatedDate, boolean before);
	
	@Transactional(readOnly=true)
	void initTags(Taggable taggable, Long componentId, ComponentEnum component);
	
	@Transactional(readOnly=false)
	int removeAllTag(ComponentEnum component, Long componentId);
}
